package com.wicket.okrcomponent.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrcomponent.biz.service.SchemeOpenRecordService;
import com.wicket.okrcomponent.biz.service.dto.req.*;
import com.wicket.okrcomponent.biz.service.dto.res.*;
import com.wicket.okrcomponent.common.ro.OkrResult;
import com.wicket.okrcomponent.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/comp/schemeOpenRecord/")
public class SchemeOpenRecordController {

    @Autowired
    SchemeOpenRecordService schemeOpenRecordService;



    /**
   * D2-3新增方案开通记录
   */
    @PostMapping("addSchemeOpenRecord")
    public OkrResult<AddSchemeOpenRecordRespDto> addSchemeOpenRecord(@RequestBody @Validated AddSchemeOpenRecordReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addSchemeOpenRecord(reqDTO));
    }

    /**
   * D2-3查询应用实例配置关系列表
   */
    @PostMapping("queryApplexConrelList")
    public OkrResult<QueryApplexConrelListRespDto> queryApplexConrelList(@RequestBody @Validated QueryApplexConrelListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryApplexConrelListRespDto retData = schemeOpenRecordService.queryApplexConrelList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D2-3修改方案开通记录
   */
    @PostMapping("updateSchemeOpenRecord")
    public OkrResult<UpdateSchemeOpenRecordRespDto> updateSchemeOpenRecord(@RequestBody @Validated UpdateSchemeOpenRecordReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.updateSchemeOpenRecord(reqDTO));
    }

    /**
   * D2-3删除方案开通记录
   */
    @PostMapping("deleteSchemeOpenRecord")
    public OkrResult<DeleteSchemeOpenRecordRespDto> deleteSchemeOpenRecord(@RequestBody @Validated DeleteSchemeOpenRecordReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.deleteSchemeOpenRecord(reqDTO));
    }

    /**
   * D2-3查询方案开通记录详情
   */
    @PostMapping("querySchemeOpenRecordDetail")
    public OkrResult<QuerySchemeOpenRecordDetailRespDto> querySchemeOpenRecordDetail(@RequestBody @Validated QuerySchemeOpenRecordDetailReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.querySchemeOpenRecordDetail(reqDTO));
    }

    /**
   * D2-3升级开通方案
   */
    @PostMapping("archiveSchemeOpenRecord")
    public OkrResult<ArchiveSchemeOpenRecordRespDto> archiveSchemeOpenRecord(@RequestBody @Validated ArchiveSchemeOpenRecordReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.archiveSchemeOpenRecord(reqDTO));
    }

    /**
   * D2-3查询方案开通记录列表
   */
    @PostMapping("querySchemeOpenRecordList")
    public OkrResult<QuerySchemeOpenRecordListRespDto> querySchemeOpenRecordList(@RequestBody @Validated QuerySchemeOpenRecordListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QuerySchemeOpenRecordListRespDto retData = schemeOpenRecordService.querySchemeOpenRecordList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D2-3新增应用实例配置关系(公共)
   */
    @PostMapping("addApplexConrelCom")
    public OkrResult<AddApplexConrelComRespDto> addApplexConrelCom(@RequestBody @Validated AddApplexConrelComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addApplexConrelCom(reqDTO));
    }

/**
   * D2-3更新方案开通记录回增(公共)
   */
    @PostMapping("refreshSchemeOpenRecordAddCom")
    public OkrResult<RefreshSchemeOpenRecordAddComRespDto> refreshSchemeOpenRecordAddCom(@RequestBody @Validated RefreshSchemeOpenRecordAddComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.refreshSchemeOpenRecordAddCom(reqDTO));
    }
/**
   * D2-3更新方案开通记录扣减(公共)
   */
    @PostMapping("refreshSchemeOpenRecordDeductionCom")
    public OkrResult<RefreshSchemeOpenRecordDeductionComRespDto> refreshSchemeOpenRecordDeductionCom(@RequestBody @Validated RefreshSchemeOpenRecordDeductionComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.refreshSchemeOpenRecordDeductionCom(reqDTO));
    }
/**
   * D2-3删除应用实例配置关系(公共)
   */
    @PostMapping("deleteApplexConrelCom")
    public OkrResult<DeleteApplexConrelComRespDto> deleteApplexConrelCom(@RequestBody @Validated DeleteApplexConrelComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.deleteApplexConrelCom(reqDTO));
    }
/**
   * D2-3发布方案开通记录(公共)
   */
    @PostMapping("releaseSchemeOpenRecordCom")
    public OkrResult<ReleaseSchemeOpenRecordComRespDto> releaseSchemeOpenRecordCom(@RequestBody @Validated ReleaseSchemeOpenRecordComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.releaseSchemeOpenRecordCom(reqDTO));
    }
/**
   * D2-3查方案授权信息详情(公共)（跨服务）
   */
    @PostMapping("querySchemeAuthInfoDetailCom")
    public OkrResult<QuerySchemeAuthInfoDetailComRespDto> querySchemeAuthInfoDetailCom(@RequestBody @Validated QuerySchemeAuthInfoDetailComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.querySchemeAuthInfoDetailCom(reqDTO));
    }
/**
   * D2-3查询方案开通记录详情(公共)
   */
    @PostMapping("querySchemeOpenRecordDetailCom")
    public OkrResult<QuerySchemeOpenRecordDetailComRespDto> querySchemeOpenRecordDetailCom(@RequestBody @Validated QuerySchemeOpenRecordDetailComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.querySchemeOpenRecordDetailCom(reqDTO));
    }
/**
   * D2-3新增方案开通记录(公共)
   */
    @PostMapping("addSchemeOpenRecordCom")
    public OkrResult<AddSchemeOpenRecordComRespDto> addSchemeOpenRecordCom(@RequestBody @Validated AddSchemeOpenRecordComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addSchemeOpenRecordCom(reqDTO));
    }
/**
   * D2-3查询方案授权情况(公共)
   */
    @PostMapping("querySchemeImpowerCaseDetailCom")
    public OkrResult<QuerySchemeImpowerCaseDetailComRespDto> querySchemeImpowerCaseDetailCom(@RequestBody @Validated QuerySchemeImpowerCaseDetailComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.querySchemeImpowerCaseDetailCom(reqDTO));
    }
/**
   * D2-3新增模板方案配置关系
   */
    @PostMapping("addTempSchemeConrel")
    public OkrResult<AddTempSchemeConrelRespDto> addTempSchemeConrel(@RequestBody @Validated AddTempSchemeConrelReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addTempSchemeConrel(reqDTO));
    }
/**
   * D2-3删除模板方案配置关系
   */
    @PostMapping("deleteTempSchemeConrel")
    public OkrResult<DeleteTempSchemeConrelRespDto> deleteTempSchemeConrel(@RequestBody @Validated DeleteTempSchemeConrelReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.deleteTempSchemeConrel(reqDTO));
    }
/**
   * D2-3删除模板方案配置关系(公共)
   */
    @PostMapping("deleteTempSchemeConrelCom")
    public OkrResult<DeleteTempSchemeConrelComRespDto> deleteTempSchemeConrelCom(@RequestBody @Validated DeleteTempSchemeConrelComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.deleteTempSchemeConrelCom(reqDTO));
    }
/**
   * D2-3新增模板方案配置关系(公共)
   */
    @PostMapping("addTempSchemeConrelCom")
    public OkrResult<AddTempSchemeConrelComRespDto> addTempSchemeConrelCom(@RequestBody @Validated AddTempSchemeConrelComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addTempSchemeConrelCom(reqDTO));
    }
/**
   * D2-3新增空间方案开通记录(公共)
   */
    @PostMapping("addSpaceSchemeOpenRecordCom")
    public OkrResult<AddSpaceSchemeOpenRecordComRespDto> addSpaceSchemeOpenRecordCom(@RequestBody @Validated AddSpaceSchemeOpenRecordComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addSpaceSchemeOpenRecordCom(reqDTO));
    }
/**
   * D2更新方案开通记录授权使用类型状态(公共)
   */
    @PostMapping("refreshSchemeOpenRecordAuthUseTypeCom")
    public OkrResult<RefreshSchemeOpenRecordAuthUseTypeComRespDto> refreshSchemeOpenRecordAuthUseTypeCom(@RequestBody @Validated RefreshSchemeOpenRecordAuthUseTypeComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.refreshSchemeOpenRecordAuthUseTypeCom(reqDTO));
    }
/**
   * D2-3更新删除涉及授权方案信息(公共)
   */
    @PostMapping("refreshDelInvolveAuthorizationSchInfoCom")
    public OkrResult<RefreshDelInvolveAuthorizationSchInfoComRespDto> refreshDelInvolveAuthorizationSchInfoCom(@RequestBody @Validated RefreshDelInvolveAuthorizationSchInfoComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.refreshDelInvolveAuthorizationSchInfoCom(reqDTO));
    }
/**
   * D2执行更新开通记录(公共)
   */
    @PostMapping("implementUpdateSchOpenRecordCom")
    public OkrResult<ImplementUpdateSchOpenRecordComRespDto> implementUpdateSchOpenRecordCom(@RequestBody @Validated ImplementUpdateSchOpenRecordComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.implementUpdateSchOpenRecordCom(reqDTO));
    }
/**
   * D2新增开通记录并授权(公共)
   */
    @PostMapping("addOpenRecordAuthorizationCom")
    public OkrResult<AddOpenRecordAuthorizationComRespDto> addOpenRecordAuthorizationCom(@RequestBody @Validated AddOpenRecordAuthorizationComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.addOpenRecordAuthorizationCom(reqDTO));
    }
/**
   * D2修改开通记录(公共)
   */
    @PostMapping("updateSchOpenRecordCom")
    public OkrResult<UpdateSchOpenRecordComRespDto> updateSchOpenRecordCom(@RequestBody @Validated UpdateSchOpenRecordComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.updateSchOpenRecordCom(reqDTO));
    }
/**
   * D2-3查使用关系详情(公共)
   */
    @PostMapping("queryApplexConrelDetailCom")
    public OkrResult<QueryApplexConrelDetailComRespDto> queryApplexConrelDetailCom(@RequestBody @Validated QueryApplexConrelDetailComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.queryApplexConrelDetailCom(reqDTO));
    }
/**
   * D2修改方案开通记录(公共)
   */
    @PostMapping("updateSchemeOpenRecordCom")
    public OkrResult<UpdateSchemeOpenRecordComRespDto> updateSchemeOpenRecordCom(@RequestBody @Validated UpdateSchemeOpenRecordComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.updateSchemeOpenRecordCom(reqDTO));
    }
/**
   * D2查询开通对象使用关系列表
   */
    @PostMapping("queryOpenObjectUsageRelationshipList")
    public OkrResult<QueryOpenObjectUsageRelationshipListRespDto> queryOpenObjectUsageRelationshipList(@RequestBody @Validated QueryOpenObjectUsageRelationshipListReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.queryOpenObjectUsageRelationshipList(reqDTO));
    }
/**
   * D2执行回写单条定制答案(公共)
   */
    @PostMapping("implementWriteBackSingleCustomResultCom")
    public OkrResult<ImplementWriteBackSingleCustomResultComRespDto> implementWriteBackSingleCustomResultCom(@RequestBody @Validated ImplementWriteBackSingleCustomResultComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.implementWriteBackSingleCustomResultCom(reqDTO));
    }
/**
   * D2-3查询方案开通记录列表(公共)
   */
    @PostMapping("querySchemeOpenRecordListCom")
    public OkrResult<QuerySchemeOpenRecordListComRespDto> querySchemeOpenRecordListCom(@RequestBody @Validated QuerySchemeOpenRecordListComReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.querySchemeOpenRecordListCom(reqDTO));
    }
/**
   * D2批量改升级标准克隆答案
   */
    @PostMapping("batchUpdateUpgradeCriterionCloneResult")
    public OkrResult<BatchUpdateUpgradeCriterionCloneResultRespDto> batchUpdateUpgradeCriterionCloneResult(@RequestBody @Validated BatchUpdateUpgradeCriterionCloneResultReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.batchUpdateUpgradeCriterionCloneResult(reqDTO));
    }
/**
   * D2设置定制答案
   */
    @PostMapping("setCustomResult")
    public OkrResult<SetCustomResultRespDto> setCustomResult(@RequestBody @Validated SetCustomResultReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.setCustomResult(reqDTO));
    }
/**
   * D2执行升级单题标准克隆答案
   */
    @PostMapping("implementUpgradeSingleCriterionCloneResult")
    public OkrResult<ImplementUpgradeSingleCriterionCloneResultRespDto> implementUpgradeSingleCriterionCloneResult(@RequestBody @Validated ImplementUpgradeSingleCriterionCloneResultReqDto reqDTO){
    return OkrResult.success(schemeOpenRecordService.implementUpgradeSingleCriterionCloneResult(reqDTO));
    }
///**
//   * D2查询方案授权对象列表(公共)
//   */
//    @PostMapping("querySchemeAuthObjListCom")
//    public OkrResult<QuerySchemeAuthObjListComRespDto> querySchemeAuthObjListCom(@RequestBody @Validated QuerySchemeAuthObjListComReqDto reqDTO){
//    return OkrResult.success(schemeOpenRecordService.querySchemeAuthObjListCom(reqDTO));
//    }
///**
//   * D2执行开通方案有效性鉴权(公共)
//   */
//    @PostMapping("implementSchemeOpenRecordValidityAuthenticationCom")
//    public OkrResult<ImplementSchemeOpenRecordValidityAuthenticationComRespDto> implementSchemeOpenRecordValidityAuthenticationCom(@RequestBody @Validated ImplementSchemeOpenRecordValidityAuthenticationComReqDto reqDTO){
//    return OkrResult.success(schemeOpenRecordService.implementSchemeOpenRecordValidityAuthenticationCom(reqDTO));
//    }
///**
//   * D2更新方案开通记录授权使用类型状态(公共)
//   */
//    @PostMapping("refreshSchemeOpenRecordAuthUseTypeCom")
//    public OkrResult<RefreshSchemeOpenRecordAuthUseTypeComRespDto> refreshSchemeOpenRecordAuthUseTypeCom(@RequestBody @Validated RefreshSchemeOpenRecordAuthUseTypeComReqDto reqDTO){
//    return OkrResult.success(schemeOpenRecordService.refreshSchemeOpenRecordAuthUseTypeCom(reqDTO));
//    }
///**
//   * D2执行同时编辑的授权对象数校验(公共)
//   */
//    @PostMapping("implementSimultaneouslyCanEditObjNumValidityCom")
//    public OkrResult<ImplementSimultaneouslyCanEditObjNumValidityComRespDto> implementSimultaneouslyCanEditObjNumValidityCom(@RequestBody @Validated ImplementSimultaneouslyCanEditObjNumValidityComReqDto reqDTO){
//    return OkrResult.success(schemeOpenRecordService.implementSimultaneouslyCanEditObjNumValidityCom(reqDTO));
//    }
}
